﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DevExpress.Xpo;

namespace ChuanPlus
{
    public class Order : XPLiteObject
    {
        //======== TAO LIEN KET =================
            [Association("Order-OrderDetails")]
            public XPCollection<OrderDetails> OrderDetails { get { return GetCollection<OrderDetails>("OrderDetails"); } }            

        //======== END TAO LIEN KET =============

        string fOrderID;
        [Key]
        [Size(10)]
        public string OrderID
        {
            get { return fOrderID; }
            set { SetPropertyValue<string>("OrderID", ref fOrderID, value); }
        }
        Customer fCustomerID;
        
        public Customer CustomerID
        {
            get { return fCustomerID; }
            set { SetPropertyValue<Customer>("CustomerID", ref fCustomerID, value); }
        }

        DateTime fOrderDate;
        public DateTime OrderDate
        {
            get { return fOrderDate; }
            set { SetPropertyValue<DateTime>("OrderDate", ref fOrderDate, value); }
        }
        string fTOPayment;
        public string TOPayment
        {
            get { return fTOPayment; }
            set { SetPropertyValue<string>("TOPayment", ref fTOPayment, value); }
        }
        DateTime fDeliveryDate;
        public DateTime DeliveryDate
        {
            get { return fDeliveryDate; }
            set { SetPropertyValue<DateTime>("DeliveryDate", ref fDeliveryDate, value); }
        }
        Users fSalesRep;
        
        public Users SalesRep
        {
            get { return fSalesRep; }
            set { SetPropertyValue<Users>("SalesRep", ref fSalesRep, value); }
        }
        string fRedInvNo;
        [Size(10)]
        public string RedInvNo
        {
            get { return fRedInvNo; }
            set { SetPropertyValue<string>("RedInvNo", ref fRedInvNo, value); }
        }
        string fRemark;
        [Size(200)]
        public string Remark
        {
            get { return fRemark; }
            set { SetPropertyValue<string>("Remark", ref fRemark, value); }
        }
        double fCusCommission;
        public double CusCommission
        {
            get { return fCusCommission; }
            set { SetPropertyValue<double>("CusCommission", ref fCusCommission, value); }
        }
        double fTotal;
        public double Total
        {
            get { return fTotal; }
            set { SetPropertyValue<double>("Total", ref fTotal, value); }
        }
        Users fCreatedBy;
        
        public Users CreatedBy
        {
            get { return fCreatedBy; }
            set { SetPropertyValue<Users>("CreatedBy", ref fCreatedBy, value); }
        }
        Users fUpdatedBy;
        
        public Users UpdatedBy
        {
            get { return fUpdatedBy; }
            set { SetPropertyValue<Users>("UpdatedBy", ref fUpdatedBy, value); }
        }
        string fStatus;
        [Size(1)]
        public string Status
        {
            get { return fStatus; }
            set { SetPropertyValue<string>("Status", ref fStatus, value); }
        }
        double fPayInAdvance;
        public double PayInAdvance
        {
            get { return fPayInAdvance; }
            set { SetPropertyValue<double>("PayInAdvance", ref fPayInAdvance, value); }
        }

        
        public Order(Session session) : base(session) { }
        public Order() : base(Session.DefaultSession) { }
        public override void AfterConstruction() { base.AfterConstruction(); }
        /// <summary>
        /// Initializes a new instance of the Order class.
        /// </summary>
        /// <param name="fOrderID"></param>
        /// <param name="fCustomerID"></param>
        /// <param name="fOrderDate"></param>
        /// <param name="fTOPayment"></param>
        /// <param name="fDeliveryDate"></param>
        /// <param name="fSalesRep"></param>
        /// <param name="fRedInvNo"></param>
        /// <param name="fRemark"></param>
        /// <param name="fCusCommission"></param>
        /// <param name="fTotal"></param>
        /// <param name="fCreatedBy"></param>
        /// <param name="fUpdatedBy"></param>
        /// <param name="fStatus"></param>
        public Order(Session s, string fOrderID, Customer fCustomerID, DateTime fOrderDate, string fTOPayment, DateTime fDeliveryDate, Users fSalesRep, string fRedInvNo, string fRemark, double fCusCommission, double fTotal, Users fCreatedBy, Users fUpdatedBy, string fStatus):base(s)
        {
            this.fOrderID = fOrderID;
            this.fCustomerID = fCustomerID;
            this.fOrderDate = fOrderDate;
            this.fTOPayment = fTOPayment;
            this.fDeliveryDate = fDeliveryDate;
            this.fSalesRep = fSalesRep;
            this.fRedInvNo = fRedInvNo;
            this.fRemark = fRemark;
            this.fCusCommission = fCusCommission;
            this.fTotal = fTotal;
            this.fCreatedBy = fCreatedBy;
            this.fUpdatedBy = fUpdatedBy;
            this.fStatus = fStatus;
        }
        /// <summary>
        /// Initializes a new instance of the Order class.
        /// </summary>
        /// <param name="fOrderID"></param>
        /// <param name="fCustomerID"></param>
        /// <param name="fOrderDate"></param>
        /// <param name="fTOPayment"></param>
        /// <param name="fDeliveryDate"></param>
        /// <param name="fSalesRep"></param>
        /// <param name="fRedInvNo"></param>
        /// <param name="fRemark"></param>
        /// <param name="fCusCommission"></param>
        /// <param name="fTotal"></param>
        /// <param name="fCreatedBy"></param>
        /// <param name="fUpdatedBy"></param>
        /// <param name="fStatus"></param>
        /// <param name="fPayInAdvance"></param>
        public Order(string fOrderID, Customer fCustomerID, DateTime fOrderDate, string fTOPayment, DateTime fDeliveryDate, Users fSalesRep, string fRedInvNo, string fRemark, double fCusCommission, double fTotal, Users fCreatedBy, Users fUpdatedBy, string fStatus, double fPayInAdvance)
        {
            this.fOrderID = fOrderID;
            this.fCustomerID = fCustomerID;
            this.fOrderDate = fOrderDate;
            this.fTOPayment = fTOPayment;
            this.fDeliveryDate = fDeliveryDate;
            this.fSalesRep = fSalesRep;
            this.fRedInvNo = fRedInvNo;
            this.fRemark = fRemark;
            this.fCusCommission = fCusCommission;
            this.fTotal = fTotal;
            this.fCreatedBy = fCreatedBy;
            this.fUpdatedBy = fUpdatedBy;
            this.fStatus = fStatus;
            this.fPayInAdvance = fPayInAdvance;
        }
    }
}
